<?php
/**
 * 小说分类Dao
 */

class Dao_NovelCategoryModel extends Dao_BaseModel {

    protected $_table = 'novel_category';

    const NORMAL_STATUS = 1;
    const REDIS_KEYWORD = 'NOVEL_CATEGORY_KEY_';
    const EXTIME        = '86400';

    public function __construct ()
    {
        parent::__construct ();
    }
    
    /**
     * 根据分类id获取分类信息
     */
    public function getByCategoryId ($wheres = [])
    {
        $where   = array ();
        $where[] = array ( 'cate_id' , $wheres['category_id']);
        $where[]  = array ( 'cate_status' , self::NORMAL_STATUS );
        $info = parent::getOne( array ( 'cate_id' , 'cate_name' ) , $where );
        return $info;
    }

    /**
     * 获取小说分类.
     * @param array $wheres
     * @return array|bool
     */
    public function getNovelCategoryList ($wheres = [])
    {
        $where    = array ();
        $where[]  = array ( 'cate_status' , self::NORMAL_STATUS );
        $info = parent::getRows ( array ( 'cate_id' , 'cate_name' ) , $where );
        return $info;
    }
    
}
